pub fn convert_base(num_str: &str, to_base: u32) -> String {
    let mut num_vec = vec![];

    let mut iter = num_str.chars().enumerate();

    // Stage 1: 解析数字并寻找进制开始字符 `(`
    let base_idx = loop {
        let (idx, c) = iter.next().unwrap();
        if c == '(' {
            break idx + 1;
        }
        num_vec.push(c);
    };

    // Stage 2: 解析进制, 并寻找进制结束字符 `)`
    let base = loop {
        let (idx, c) = iter.next().unwrap();
        if c == ')' {
            break num_str[base_idx..idx].parse::<u32>().unwrap();
        }
    };
    // Stage 3: 将数字从 base 进制转换为 10 进制
    let mut num = 0;
    for idx in 0..num_vec.len() {
        let digit = match num_vec[idx] {
            '0'..='9' => num_vec[idx] as u32 - '0' as u32,
            'a'..='e' => num_vec[idx] as u32 - 'a' as u32 + 10,
            _ => panic!("Invalid character in number"),
        };

        num = num * base + digit;
    }

    // Stage 4: 将 10 进制数字转换为 to_base 进制
    let mut result = Vec::new();

    while num > 0 {
        let digit = num % to_base;
        let c = match digit {
            0..=9 => (digit + '0' as u32) as u8 as char,
            10..=15 => (digit - 10 + 'a' as u32) as u8 as char,
            _ => panic!("Invalid digit"),
        };
        result.push(c);
        num /= to_base;
    }

    result.into_iter().rev().collect()
}
